package com.yu.shortlink.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yu.shortlink.project.common.convention.result.Result;
import com.yu.shortlink.project.common.convention.result.Results;
import com.yu.shortlink.project.dto.req.ShortLinkAccessRecordReqDTO;
import com.yu.shortlink.project.dto.resp.ShortLinkStatsAccessRecordRespDTO;
import com.yu.shortlink.project.service.ShortLinkService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author yushiwang
 * @Date 2024/7/4 21:14
 * @PackageName:com.yu.shortlink.project.controller
 * @ClassName: ShortLinkStatsController
 * @Version 1.0
 */
@RestController
@RequiredArgsConstructor
public class ShortLinkStatsController {

    private final ShortLinkService shortLinkService;

    /**
     * 访问单个短链接指定时间内监控数据
     */
    /*@GetMapping("/api/short-link/v1/stats")
    public Result<ShortLinkStatsRespDTO> shortLinkStats(ShortLinkStatsReqDTO requestParam){
        return Results.success(shortLinkService.oneShortLinkStats(requestParam));
    }*/

    /**
     * 访问单个短链接指定时间内访问记录监控数据
     */
    @GetMapping("/api/short-link/v1/access-record")
    public Result<IPage<ShortLinkStatsAccessRecordRespDTO>> shortLinkAccessRecord(ShortLinkAccessRecordReqDTO requestParam){
        return Results.success(shortLinkService.shortLinkAccessRecord(requestParam));
    }
}
